﻿@model SuperiorModel.ProductSkuManagerModel
@{
    ViewBag.Title = "设置商品规格";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<input type="hidden" id="mapRotute" map="map_product" />
<style>
    .SkuValueInput {
        height: 26px;
        padding-left: 15px;
        border: 1px solid #cccccc;
        width: 8%;
        margin-left: 22px;
    }

    .SkuValueInput2 {
        height: 26px;
        padding-left: 15px;
        border: 1px solid #cccccc;
        width: 68%;
        margin-left: 22px;
    }
</style>
<style>
    /*控制文本框长度*/
</style>
<div class="title_ding">

    <p id="location">
        当前位置：
        商品管理
    </p>
</div>
<div class="layui">
    <div class="shopmain">
        <div class="layui-card">
            <div class="layui-card-header">设置商品规格</div>
            <div class="layui-card-body">
                <div class="layui-form" action="">
                    <div class="layui-form-item">
                        <label for="ProductName" class="layui-form-label">
                            商品规格
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            @if (Model.SkuType == 1)
                            {
                                <input type="radio" name="skuRadio" lay-filter="skuRadio" value="1" title="单规格" checked>
                                <input type="radio" name="skuRadio" lay-filter="skuRadio" value="2" title="多规格">
                            }
                            else
                            {
                                <input type="radio" name="skuRadio" lay-filter="skuRadio" value="1" title="单规格" >
                                <input type="radio" name="skuRadio" lay-filter="skuRadio" value="2" title="多规格" checked>
                            }
                            
                        </div>

                    </div>

                </div>
                <div class="layui-form" action="" id="singleForm" style="display:@(Model.SkuType==1?"block":"none")">
                    <div class="layui-form-item">
                        <label for="SallPrice" class="layui-form-label">
                            商品价格
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="SallPrice" name="SallPrice" lay-verify="required|isMoney|greaterThanZero" value="@Model.SingleSkuModel.SallPrice" class="layui-input" placeholder="请输入商品价格,必须大于0并且保留两位小数,如'1.00','3.42'">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="StockNum" class="layui-form-label">
                            商品库存
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="StockNum" name="StockNum" lay-verify="required|number" class="layui-input" value="@Model.SingleSkuModel.StockNum" placeholder="请输入商品库存">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="SkuCode" class="layui-form-label">
                            商品编码
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="SkuCode" name="SkuCode" class="layui-input" value="@Model.SingleSkuModel.SkuCode" placeholder="请输入商品编码，选填">
                        </div>

                    </div>
                    <div class="layui-form-item">
                        <label for="SkuWeight" class="layui-form-label">
                            商品重量(kg)
                        </label>
                        <div class="layui-input-inline" style="width:50%">
                            <input type="text" id="SkuWeight" name="SkuWeight" class="layui-input" value="@Model.SingleSkuModel.Weight" placeholder="请输入商品重量，选填">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*重量涉及重量运费模板计算运费</span>
                        </div>
                    </div>

                    <div class="layui-form-item" style="text-align:center;">
                        <div class="layui-input-block" style="margin:0;">
                            <button class="layui-btn" lay-submit lay-filter="add" SkuType="1">保存并设置成单规格</button>
                            <button type="reset" class="layui-btn btnBack">返回</button>
                        </div>
                    </div>

                </div>
                <div id="moreForm" style="display:@(Model.SkuType==2?"block":"none");">
                    <fieldset class="layui-elem-field layui-field-title">
                        <legend>规格管理</legend>
                        <div class="layui-field-box">
                            <div class="layui-form" action="">

                                <div class="layui-form-item">

                                    <div class="layui-input-inline" style="width:13%">
                                        <input type="text" id="PropetyName" name="SkuName" lay-verify="required" class="layui-input" placeholder="规格名称,比如 '颜色' ">
                                    </div>
                                    <div class="layui-input-inline" style="width:13%">
                                        <input type="text" id="PropetyValue" name="SkuName" lay-verify="required" class="layui-input" placeholder="规格值,比如 '红色'">
                                    </div>
                                    <button class="layui-btn" id="btnAddPropetyName">确认添加</button>
                                </div>


                            </div>

                            <div class="layui-form" action="" id="skuList">

                            

                            </div>

                            <fieldset class="layui-elem-field layui-field-title">
                                <legend>商品规格设置</legend>
                                <div class="layui-field-box">
                                    <div class="layui-form" action="">
                                        <div class="layui-form-item">

                                            <div class="layui-input-inline" style="width:13%">
                                                <input type="text" id="SallPrice_batch" name="SallPrice_batch" lay-verify="required|isMoney|greaterThanZero" class="layui-input" placeholder="商品价格">
                                            </div>
                                            <div class="layui-input-inline" style="width:13%">
                                                <input type="text" id="StockNum_batch" name="StockNum_batch" lay-verify="required|number" class="layui-input" placeholder="商品库存">
                                            </div>
                                            <div class="layui-input-inline" style="width:13%">
                                                <input type="text" id="SkuCode_batch" name="SkuCode_batch"  class="layui-input" placeholder="商品编码">

                                            </div>
                                            <div class="layui-input-inline" style="width:13%">
                                                <input type="text" id="SkuWeight_batch" name="SkuWeight_batch" lay-verify="required" class="layui-input" placeholder="商品重量(kg)">

                                            </div>
                                            <div class="layui-input-inline" style="width:13%">
                                                <button class="layui-btn" lay-submit lay-filter="add" SkuType="3">批量设置</button>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form" action="">

                                        <div>
                                            <table class="layui-table" id="skuTable">
                                                
                                            </table>
                                        </div>
                                        <div class="layui-form-item" style="text-align:center;">
                                            <div class="layui-input-block" style="margin:0;">
                                                <button class="layui-btn" lay-submit lay-filter="add" SkuType="2">保存并设置成多规格</button>
                                                <button type="reset" class="layui-btn btnBack">返回</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </fieldset>



                        </div>
                    </fieldset>
                </div>



            </div>
        </div>
    </div>
</div>
<script src="~/scripts/Product/ProductSku.js?v=1"></script>
<script>
    ProductSkuClass.Instance.Init();
</script>